#include "http.h"
#include "task.h"

int main() {
  auto server = co_async::HttpServer("0.0.0.0", 8848);
  server.set_static_dir("/home/yj/下载/html");
  server.post("/test",
              [](const co_async::HttpRequest &req)
                  -> co_async::Task<co_async::HttpResponse> {
                for (const auto &node : req.get_params().items()) {
                  std::cout << node.key() << ": " << node.value() << std::endl;
                }
                co_return {200,
                           {{"Content-Type", "text/plain; charset=utf-8"}},
                           req.get_body()};
              });
  server.serve();
}